package com.myaihui.controller;

import com.myaihui.domain.User;
import lombok.extern.slf4j.Slf4j;
import com.myaihui.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2018/5/18
 * *******************************
 */
@Controller
@Slf4j
public class HomeController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView home(){
        return new ModelAndView("index");
    }

    @RequestMapping(value = "/api")
    @ResponseBody
    public User ok(){
        return userService.getByName("测试");
    }
}
